package Tools.Logger;

import java.io.InvalidObjectException;
import java.io.ObjectStreamException;
import java.util.logging.Level;

/**
 * Created by IntelliJ IDEA.
 * User: leontiad
 * Date: Mar 9, 2010
 * Time: 3:58:38 PM
 * To change this template use File | Settings | File Templates.
 */
public class StdOutErrLevel extends Level {


    private StdOutErrLevel(String name, int value) {
        super(name, value);
    }

    //Level for STDOUT activity.
    public static Level STDOUT = new StdOutErrLevel("STDOUT", Level.INFO.intValue()+53);

    //Level for STDERR activity
    public static Level STDERR = new StdOutErrLevel("STDERR", Level.INFO.intValue()+54);

    //Method to avoid creating duplicate instances when deserializing the object.
    protected Object readResolve()
	throws ObjectStreamException {
        if (this.intValue() == STDOUT.intValue())
            return STDOUT;
        if (this.intValue() == STDERR.intValue())
            return STDERR;
        throw new InvalidObjectException("Unknown instance :" + this);
    }

}

